package com.marquis.cloud.controller;

import com.marquis.cloud.entity.Person;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/person/")
public class PersonController {

    /**
     *
     * @param request
     * @param id
     * @return
     */
    @RequestMapping(value = "findById/{id}")
    public Person findById(HttpServletRequest request,  @PathVariable("id") Integer id){
        Person person = new Person();
        person.setId(id);
        person.setName("张三");
        person.setMessage(request.getRequestURL().toString());
        return person;
    }
}
